package com.usian.admin.config;

import com.usian.utils.common.AppJwtUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

@Configuration
public class FeginConfig implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate requestTemplate) {
        // 2. 把获取到的token放到请求头中
        requestTemplate.header("token", AppJwtUtil.getToken(1L));
    }
}
